import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:tracker/startup/env/env.dart';
import 'package:tracker/theme/app_theme.dart';
import 'package:tracker/utils/upgrade_utils.dart';

class AboutPage extends HookWidget {
  const AboutPage({super.key});

  @override
  Widget build(BuildContext context) {
    final appName = useState(Env.envConfig.appName);
    final appVersion = useState(Env.envConfig.appVersion);
    return Scaffold(
      appBar: AppBar(
        title: const Text(
          "关于",
        ),
        centerTitle: true,
        backgroundColor: AppTheme.themeConfig.primaryColor,
        foregroundColor: Colors.white,
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          SizedBox(
              width: 80,
              height: 80,
              child: ClipOval(
                child: Image(
                  image: AssetImage('assets/images/logo/xlww_logo_120.png'),
                  width: 80,
                ),
              )),
          const SizedBox(
            height: 20,
          ),
          SizedBox(
            width: double.infinity,
            child: Text(
              appName.value,
              textAlign: TextAlign.center,
              style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
            ),
          ),
          const SizedBox(
            height: 20,
          ),
          SizedBox(
            width: double.infinity,
            child: Text(
              '版本号: ${appVersion.value}',
              style: TextStyle(color: AppTheme.themeConfig.infoTextColor),
              textAlign: TextAlign.center,
            ),
          ),
          // Container(
          //   width: double.infinity,
          //   child: Text('Build ${Env.envConfig.buildNumber}', style: TextStyle(color: AppTheme.themeConfig.infoTextColor), textAlign: TextAlign.center,),
          // ),
          const SizedBox(
            height: 60,
          ),
          SizedBox(
            width: double.infinity,
            child: Text(
              '联系客服: 15999643043',
              style: TextStyle(color: AppTheme.themeConfig.infoTextColor),
              textAlign: TextAlign.center,
            ),
          ),
          // 检查更新
          // TextButton(
          //   onPressed: () {
          //     UpgradeUtils.checkUpdateByManual(context, fromPage: 'about');
          //   },
          //   child: const Text('检查更新'),
          // ),

        ],
      ),
    );
  }
}
